<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link href="cpip.css" rel="stylesheet" type="text/css" />
    <title>File: /Users/paulross/dev/linux/linux-3.13/include/asm-generic/pgtable.h</title>
  </head>
  <body>
    <h1>File: /Users/paulross/dev/linux/linux-3.13/include/asm-generic/pgtable.h</h1>
    <p>Green shading in the line number column
means the source is part of the translation unit, red means it is conditionally excluded.
Highlighted line numbers link to the translation unit page. Highlighted macros link to
the macro page.</p>
    <pre><a name="1" /><span class="True">       1:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_noref.html#_X0FTTV9HRU5FUklDX1BHVEFCTEVfSF8w"><span class="b">_ASM_GENERIC_PGTABLE_H</span></a>
<a name="2" /><span class="True">       2:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_X0FTTV9HRU5FUklDX1BHVEFCTEVfSF8w"><span class="b">_ASM_GENERIC_PGTABLE_H</span></a>
<a name="3" /><span class="True">       3:</span> 
<a name="4" /><span class="True">       4:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__ASSEMBLY__</span>
<a name="5" /><span class="True">       5:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX01NVV8w"><span class="b">CONFIG_MMU</span></a>
<a name="6" /><span class="True">       6:</span> 
<a name="7" /><span class="True">       7:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">mm_types</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="8" /><span class="True">       8:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">bug</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="9" /><span class="True">       9:</span> 
<a name="10" /><span class="True">      10:</span> <span class="k">/*</span>
<a name="11" /><span class="True">      11:</span> <span class="k"> * On almost all architectures and configurations, 0 can be used as the</span>
<a name="12" /><span class="True">      12:</span> <span class="k"> * upper ceiling to free_pgtables(): on many architectures it has the same</span>
<a name="13" /><span class="True">      13:</span> <span class="k"> * effect as using TASK_SIZE.  However, there is one configuration which</span>
<a name="14" /><span class="True">      14:</span> <span class="k"> * must impose a more careful limit, to avoid freeing kernel pgtables.</span>
<a name="15" /><span class="True">      15:</span> <span class="k"> */</span>
<a name="16" /><span class="True">      16:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_noref.html#_VVNFUl9QR1RBQkxFU19DRUlMSU5HXzA_"><span class="b">USER_PGTABLES_CEILING</span></a>
<a name="17" /><span class="True">      17:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_VVNFUl9QR1RBQkxFU19DRUlMSU5HXzA_"><span class="b">USER_PGTABLES_CEILING</span></a>    <span class="c">0UL</span>
<a name="18" /><span class="True">      18:</span> <span class="f">#</span><span class="n">endif</span>
<a name="19" /><span class="True">      19:</span> 
<a name="20" /><span class="False">      20:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUFRFUF9TRVRfQUNDRVNTX0ZMQUdTXzA_"><span class="b">__HAVE_ARCH_PTEP_SET_ACCESS_FLAGS</span></a>
<a name="21" /><span class="False">      21:</span> <span class="m">extern</span> <span class="m">int</span> <span class="b">ptep_set_access_flags</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="22" /><span class="False">      22:</span>                  <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span> <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">,</span>
<a name="23" /><span class="False">      23:</span>                  <span class="b">pte_t</span> <span class="b">entry</span><span class="f">,</span> <span class="m">int</span> <span class="b">dirty</span><span class="f">)</span><span class="f">;</span>
<a name="24" /><span class="True">      24:</span> <span class="f">#</span><span class="n">endif</span>
<a name="25" /><span class="True">      25:</span> 
<a name="26" /><span class="False">      26:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUE1EUF9TRVRfQUNDRVNTX0ZMQUdTXzA_"><span class="b">__HAVE_ARCH_PMDP_SET_ACCESS_FLAGS</span></a>
<a name="27" /><span class="False">      27:</span> <span class="m">extern</span> <span class="m">int</span> <span class="b">pmdp_set_access_flags</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="28" /><span class="False">      28:</span>                  <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">,</span>
<a name="29" /><span class="False">      29:</span>                  <span class="b">pmd_t</span> <span class="b">entry</span><span class="f">,</span> <span class="m">int</span> <span class="b">dirty</span><span class="f">)</span><span class="f">;</span>
<a name="30" /><span class="True">      30:</span> <span class="f">#</span><span class="n">endif</span>
<a name="31" /><span class="True">      31:</span> 
<a name="32" /><span class="False">      32:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUFRFUF9URVNUX0FORF9DTEVBUl9ZT1VOR18w"><span class="b">__HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG</span></a>
<a name="33" /><span class="False">      33:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">ptep_test_and_clear_young</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="34" /><span class="False">      34:</span>                         <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span>
<a name="35" /><span class="False">      35:</span>                         <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">)</span>
<a name="36" /><span class="False">      36:</span> <span class="f">{</span>
<a name="37" /><span class="False">      37:</span>     <span class="b">pte_t</span> <span class="b">pte</span> <span class="f">=</span> <span class="f">*</span><span class="b">ptep</span><span class="f">;</span>
<a name="38" /><span class="False">      38:</span>     <span class="m">int</span> <span class="b">r</span> <span class="f">=</span> <span class="c">1</span><span class="f">;</span>
<a name="39" /><span class="False">      39:</span>     <span class="m">if</span> <span class="f">(</span><span class="f">!</span><span class="b">pte_young</span><span class="f">(</span><span class="b">pte</span><span class="f">)</span><span class="f">)</span>
<a name="40" /><span class="False">      40:</span>         <span class="b">r</span> <span class="f">=</span> <span class="c">0</span><span class="f">;</span>
<a name="41" /><span class="False">      41:</span>     <span class="m">else</span>
<a name="42" /><span class="False">      42:</span>         <a href="cpu.c_macros_ref.html#_c2V0X3B0ZV9hdF8w"><span class="b">set_pte_at</span></a><span class="f">(</span><span class="b">vma</span><span class="f">-&gt;</span><span class="b">vm_mm</span><span class="f">,</span> <span class="b">address</span><span class="f">,</span> <span class="b">ptep</span><span class="f">,</span> <span class="b">pte_mkold</span><span class="f">(</span><span class="b">pte</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="43" /><span class="False">      43:</span>     <span class="m">return</span> <span class="b">r</span><span class="f">;</span>
<a name="44" /><span class="False">      44:</span> <span class="f">}</span>
<a name="45" /><span class="True">      45:</span> <span class="f">#</span><span class="n">endif</span>
<a name="46" /><span class="True">      46:</span> 
<a name="47" /><span class="False">      47:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUE1EUF9URVNUX0FORF9DTEVBUl9ZT1VOR18w"><span class="b">__HAVE_ARCH_PMDP_TEST_AND_CLEAR_YOUNG</span></a>
<a name="48" /><span class="False">      48:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_TRANSPARENT_HUGEPAGE</span>
<a name="49" /><span class="False">      49:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmdp_test_and_clear_young</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="50" /><span class="False">      50:</span>                         <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span>
<a name="51" /><span class="False">      51:</span>                         <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span>
<a name="52" /><span class="False">      52:</span> <span class="f">{</span>
<a name="53" /><span class="False">      53:</span>     <span class="b">pmd_t</span> <span class="b">pmd</span> <span class="f">=</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">;</span>
<a name="54" /><span class="False">      54:</span>     <span class="m">int</span> <span class="b">r</span> <span class="f">=</span> <span class="c">1</span><span class="f">;</span>
<a name="55" /><span class="False">      55:</span>     <span class="m">if</span> <span class="f">(</span><span class="f">!</span><span class="b">pmd_young</span><span class="f">(</span><span class="b">pmd</span><span class="f">)</span><span class="f">)</span>
<a name="56" /><span class="False">      56:</span>         <span class="b">r</span> <span class="f">=</span> <span class="c">0</span><span class="f">;</span>
<a name="57" /><span class="False">      57:</span>     <span class="m">else</span>
<a name="58" /><span class="False">      58:</span>         <a href="cpu.c_macros_noref.html#_c2V0X3BtZF9hdF8w"><span class="b">set_pmd_at</span></a><span class="f">(</span><span class="b">vma</span><span class="f">-&gt;</span><span class="b">vm_mm</span><span class="f">,</span> <span class="b">address</span><span class="f">,</span> <span class="b">pmdp</span><span class="f">,</span> <span class="b">pmd_mkold</span><span class="f">(</span><span class="b">pmd</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="59" /><span class="False">      59:</span>     <span class="m">return</span> <span class="b">r</span><span class="f">;</span>
<a name="60" /><span class="False">      60:</span> <span class="f">}</span>
<a name="61" /><span class="False">      61:</span> <span class="f">#</span><span class="n">else</span> <span class="k">/* CONFIG_TRANSPARENT_HUGEPAGE */</span>
<a name="62" /><span class="False">      62:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmdp_test_and_clear_young</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="63" /><span class="False">      63:</span>                         <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span>
<a name="64" /><span class="False">      64:</span>                         <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span>
<a name="65" /><span class="False">      65:</span> <span class="f">{</span>
<a name="66" /><span class="False">      66:</span>     <a href="cpu.c_macros_ref.html#_QlVHXzA_"><span class="b">BUG</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="67" /><span class="False">      67:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="68" /><span class="False">      68:</span> <span class="f">}</span>
<a name="69" /><span class="False">      69:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_TRANSPARENT_HUGEPAGE */</span>
<a name="70" /><span class="True">      70:</span> <span class="f">#</span><span class="n">endif</span>
<a name="71" /><span class="True">      71:</span> 
<a name="72" /><span class="False">      72:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUFRFUF9DTEVBUl9ZT1VOR19GTFVTSF8w"><span class="b">__HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH</span></a>
<a name="73" /><span class="False">      73:</span> <span class="m">int</span> <span class="b">ptep_clear_flush_young</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="74" /><span class="False">      74:</span>                <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span> <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">)</span><span class="f">;</span>
<a name="75" /><span class="True">      75:</span> <span class="f">#</span><span class="n">endif</span>
<a name="76" /><span class="True">      76:</span> 
<a name="77" /><span class="False">      77:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUE1EUF9DTEVBUl9ZT1VOR19GTFVTSF8w"><span class="b">__HAVE_ARCH_PMDP_CLEAR_YOUNG_FLUSH</span></a>
<a name="78" /><span class="False">      78:</span> <span class="m">int</span> <span class="b">pmdp_clear_flush_young</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="79" /><span class="False">      79:</span>                <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span><span class="f">;</span>
<a name="80" /><span class="True">      80:</span> <span class="f">#</span><span class="n">endif</span>
<a name="81" /><span class="True">      81:</span> 
<a name="82" /><span class="False">      82:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUFRFUF9HRVRfQU5EX0NMRUFSXzA_"><span class="b">__HAVE_ARCH_PTEP_GET_AND_CLEAR</span></a>
<a name="83" /><span class="False">      83:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">ptep_get_and_clear</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="84" /><span class="False">      84:</span>                        <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span>
<a name="85" /><span class="False">      85:</span>                        <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">)</span>
<a name="86" /><span class="False">      86:</span> <span class="f">{</span>
<a name="87" /><span class="False">      87:</span>     <span class="b">pte_t</span> <span class="b">pte</span> <span class="f">=</span> <span class="f">*</span><span class="b">ptep</span><span class="f">;</span>
<a name="88" /><span class="False">      88:</span>     <a href="cpu.c_macros_ref.html#_cHRlX2NsZWFyXzA_"><span class="b">pte_clear</span></a><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">address</span><span class="f">,</span> <span class="b">ptep</span><span class="f">)</span><span class="f">;</span>
<a name="89" /><span class="False">      89:</span>     <span class="m">return</span> <span class="b">pte</span><span class="f">;</span>
<a name="90" /><span class="False">      90:</span> <span class="f">}</span>
<a name="91" /><span class="True">      91:</span> <span class="f">#</span><span class="n">endif</span>
<a name="92" /><span class="True">      92:</span> 
<a name="93" /><span class="False">      93:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUE1EUF9HRVRfQU5EX0NMRUFSXzA_"><span class="b">__HAVE_ARCH_PMDP_GET_AND_CLEAR</span></a>
<a name="94" /><span class="False">      94:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_TRANSPARENT_HUGEPAGE</span>
<a name="95" /><span class="False">      95:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pmd_t</span> <span class="b">pmdp_get_and_clear</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="96" /><span class="False">      96:</span>                        <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span>
<a name="97" /><span class="False">      97:</span>                        <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span>
<a name="98" /><span class="False">      98:</span> <span class="f">{</span>
<a name="99" /><span class="False">      99:</span>     <span class="b">pmd_t</span> <span class="b">pmd</span> <span class="f">=</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">;</span>
<a name="100" /><span class="False">     100:</span>     <a href="cpu.c_macros_noref.html#_cG1kX2NsZWFyXzA_"><span class="b">pmd_clear</span></a><span class="f">(</span><span class="b">pmdp</span><span class="f">)</span><span class="f">;</span>
<a name="101" /><span class="False">     101:</span>     <span class="m">return</span> <span class="b">pmd</span><span class="f">;</span>
<a name="102" /><span class="False">     102:</span> <span class="f">}</span>
<a name="103" /><span class="False">     103:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_TRANSPARENT_HUGEPAGE */</span>
<a name="104" /><span class="True">     104:</span> <span class="f">#</span><span class="n">endif</span>
<a name="105" /><span class="True">     105:</span> 
<a name="106" /><span class="False">     106:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUFRFUF9HRVRfQU5EX0NMRUFSX0ZVTExfMA__"><span class="b">__HAVE_ARCH_PTEP_GET_AND_CLEAR_FULL</span></a>
<a name="107" /><span class="False">     107:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">ptep_get_and_clear_full</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="108" /><span class="False">     108:</span>                         <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span> <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">,</span>
<a name="109" /><span class="False">     109:</span>                         <span class="m">int</span> <span class="b">full</span><span class="f">)</span>
<a name="110" /><span class="False">     110:</span> <span class="f">{</span>
<a name="111" /><span class="False">     111:</span>     <span class="b">pte_t</span> <span class="b">pte</span><span class="f">;</span>
<a name="112" /><span class="False">     112:</span>     <span class="b">pte</span> <span class="f">=</span> <span class="b">ptep_get_and_clear</span><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">address</span><span class="f">,</span> <span class="b">ptep</span><span class="f">)</span><span class="f">;</span>
<a name="113" /><span class="False">     113:</span>     <span class="m">return</span> <span class="b">pte</span><span class="f">;</span>
<a name="114" /><span class="False">     114:</span> <span class="f">}</span>
<a name="115" /><span class="True">     115:</span> <span class="f">#</span><span class="n">endif</span>
<a name="116" /><span class="True">     116:</span> 
<a name="117" /><span class="True">     117:</span> <span class="k">/*</span>
<a name="118" /><span class="True">     118:</span> <span class="k"> * Some architectures may be able to avoid expensive synchronization</span>
<a name="119" /><span class="True">     119:</span> <span class="k"> * primitives when modifications are made to PTE&apos;s which are already</span>
<a name="120" /><span class="True">     120:</span> <span class="k"> * not present, or in the process of an address space destruction.</span>
<a name="121" /><span class="True">     121:</span> <span class="k"> */</span>
<a name="122" /><span class="True">     122:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_PTE_CLEAR_NOT_PRESENT_FULL</span>
<a name="123" /><span class="True">     123:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">pte_clear_not_present_full</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="124" /><span class="True">     124:</span>                           <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span>
<a name="125" /><span class="True">     125:</span>                           <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">,</span>
<a name="126" /><span class="True">     126:</span>                           <span class="m">int</span> <span class="b">full</span><span class="f">)</span>
<a name="127" /><span class="True">     127:</span> <span class="f">{</span>
<a name="128" /><span class="True">     128:</span>     <a href="cpu.c_macros_ref.html#_cHRlX2NsZWFyXzA_"><span class="b">pte_clear</span></a><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">address</span><span class="f">,</span> <span class="b">ptep</span><span class="f">)</span><span class="f">;</span>
<a name="129" /><span class="True">     129:</span> <span class="f">}</span>
<a name="130" /><span class="True">     130:</span> <span class="f">#</span><span class="n">endif</span>
<a name="131" /><span class="True">     131:</span> 
<a name="132" /><span class="True">     132:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_PTEP_CLEAR_FLUSH</span>
<a name="133" /><span class="True">     133:</span> <span class="m">extern</span> <span class="b">pte_t</span> <span class="b">ptep_clear_flush</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="134" /><span class="True">     134:</span>                   <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span>
<a name="135" /><span class="True">     135:</span>                   <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">)</span><span class="f">;</span>
<a name="136" /><span class="True">     136:</span> <span class="f">#</span><span class="n">endif</span>
<a name="137" /><span class="True">     137:</span> 
<a name="138" /><span class="True">     138:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_PMDP_CLEAR_FLUSH</span>
<a name="139" /><span class="True">     139:</span> <span class="m">extern</span> <span class="b">pmd_t</span> <span class="b">pmdp_clear_flush</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="140" /><span class="True">     140:</span>                   <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span>
<a name="141" /><span class="True">     141:</span>                   <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span><span class="f">;</span>
<a name="142" /><span class="True">     142:</span> <span class="f">#</span><span class="n">endif</span>
<a name="143" /><span class="True">     143:</span> 
<a name="144" /><span class="False">     144:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUFRFUF9TRVRfV1JQUk9URUNUXzA_"><span class="b">__HAVE_ARCH_PTEP_SET_WRPROTECT</span></a>
<a name="145" /><span class="False">     145:</span> <span class="m">struct</span> <span class="b">mm_struct</span><span class="f">;</span>
<a name="146" /><span class="False">     146:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">ptep_set_wrprotect</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span> <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">)</span>
<a name="147" /><span class="False">     147:</span> <span class="f">{</span>
<a name="148" /><span class="False">     148:</span>     <span class="b">pte_t</span> <span class="b">old_pte</span> <span class="f">=</span> <span class="f">*</span><span class="b">ptep</span><span class="f">;</span>
<a name="149" /><span class="False">     149:</span>     <a href="cpu.c_macros_ref.html#_c2V0X3B0ZV9hdF8w"><span class="b">set_pte_at</span></a><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">address</span><span class="f">,</span> <span class="b">ptep</span><span class="f">,</span> <span class="b">pte_wrprotect</span><span class="f">(</span><span class="b">old_pte</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="150" /><span class="False">     150:</span> <span class="f">}</span>
<a name="151" /><span class="True">     151:</span> <span class="f">#</span><span class="n">endif</span>
<a name="152" /><span class="True">     152:</span> 
<a name="153" /><span class="False">     153:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUE1EUF9TRVRfV1JQUk9URUNUXzA_"><span class="b">__HAVE_ARCH_PMDP_SET_WRPROTECT</span></a>
<a name="154" /><span class="False">     154:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_TRANSPARENT_HUGEPAGE</span>
<a name="155" /><span class="False">     155:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">pmdp_set_wrprotect</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="156" /><span class="False">     156:</span>                       <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span>
<a name="157" /><span class="False">     157:</span> <span class="f">{</span>
<a name="158" /><span class="False">     158:</span>     <span class="b">pmd_t</span> <span class="b">old_pmd</span> <span class="f">=</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">;</span>
<a name="159" /><span class="False">     159:</span>     <a href="cpu.c_macros_noref.html#_c2V0X3BtZF9hdF8w"><span class="b">set_pmd_at</span></a><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">address</span><span class="f">,</span> <span class="b">pmdp</span><span class="f">,</span> <span class="b">pmd_wrprotect</span><span class="f">(</span><span class="b">old_pmd</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="160" /><span class="False">     160:</span> <span class="f">}</span>
<a name="161" /><span class="False">     161:</span> <span class="f">#</span><span class="n">else</span> <span class="k">/* CONFIG_TRANSPARENT_HUGEPAGE */</span>
<a name="162" /><span class="False">     162:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">pmdp_set_wrprotect</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="163" /><span class="False">     163:</span>                       <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span>
<a name="164" /><span class="False">     164:</span> <span class="f">{</span>
<a name="165" /><span class="False">     165:</span>     <a href="cpu.c_macros_ref.html#_QlVHXzA_"><span class="b">BUG</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="166" /><span class="False">     166:</span> <span class="f">}</span>
<a name="167" /><span class="False">     167:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_TRANSPARENT_HUGEPAGE */</span>
<a name="168" /><span class="True">     168:</span> <span class="f">#</span><span class="n">endif</span>
<a name="169" /><span class="True">     169:</span> 
<a name="170" /><span class="False">     170:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUE1EUF9TUExJVFRJTkdfRkxVU0hfMA__"><span class="b">__HAVE_ARCH_PMDP_SPLITTING_FLUSH</span></a>
<a name="171" /><span class="False">     171:</span> <span class="m">extern</span> <span class="m">void</span> <span class="b">pmdp_splitting_flush</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="172" /><span class="False">     172:</span>                  <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span><span class="f">;</span>
<a name="173" /><span class="True">     173:</span> <span class="f">#</span><span class="n">endif</span>
<a name="174" /><span class="True">     174:</span> 
<a name="175" /><span class="True">     175:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_PGTABLE_DEPOSIT</span>
<a name="176" /><span class="True">     176:</span> <span class="m">extern</span> <span class="m">void</span> <span class="b">pgtable_trans_huge_deposit</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">,</span>
<a name="177" /><span class="True">     177:</span>                        <span class="b">pgtable_t</span> <span class="b">pgtable</span><span class="f">)</span><span class="f">;</span>
<a name="178" /><span class="True">     178:</span> <span class="f">#</span><span class="n">endif</span>
<a name="179" /><span class="True">     179:</span> 
<a name="180" /><span class="True">     180:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_PGTABLE_WITHDRAW</span>
<a name="181" /><span class="True">     181:</span> <span class="m">extern</span> <span class="b">pgtable_t</span> <span class="b">pgtable_trans_huge_withdraw</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span><span class="f">;</span>
<a name="182" /><span class="True">     182:</span> <span class="f">#</span><span class="n">endif</span>
<a name="183" /><span class="True">     183:</span> 
<a name="184" /><span class="True">     184:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_PMDP_INVALIDATE</span>
<a name="185" /><span class="True">     185:</span> <span class="m">extern</span> <span class="m">void</span> <span class="b">pmdp_invalidate</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">address</span><span class="f">,</span>
<a name="186" /><span class="True">     186:</span>                 <span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span><span class="f">;</span>
<a name="187" /><span class="True">     187:</span> <span class="f">#</span><span class="n">endif</span>
<a name="188" /><span class="True">     188:</span> 
<a name="189" /><span class="False">     189:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUFRFX1NBTUVfMA__"><span class="b">__HAVE_ARCH_PTE_SAME</span></a>
<a name="190" /><span class="False">     190:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pte_same</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte_a</span><span class="f">,</span> <span class="b">pte_t</span> <span class="b">pte_b</span><span class="f">)</span>
<a name="191" /><span class="False">     191:</span> <span class="f">{</span>
<a name="192" /><span class="False">     192:</span>     <span class="m">return</span> <a href="cpu.c_macros_ref.html#_cHRlX3ZhbF8w"><span class="b">pte_val</span></a><span class="f">(</span><span class="b">pte_a</span><span class="f">)</span> <span class="f">==</span> <a href="cpu.c_macros_ref.html#_cHRlX3ZhbF8w"><span class="b">pte_val</span></a><span class="f">(</span><span class="b">pte_b</span><span class="f">)</span><span class="f">;</span>
<a name="193" /><span class="False">     193:</span> <span class="f">}</span>
<a name="194" /><span class="True">     194:</span> <span class="f">#</span><span class="n">endif</span>
<a name="195" /><span class="True">     195:</span> 
<a name="196" /><span class="True">     196:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_PMD_SAME</span>
<a name="197" /><span class="False">     197:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_TRANSPARENT_HUGEPAGE</span>
<a name="198" /><span class="False">     198:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_same</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd_a</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="b">pmd_b</span><span class="f">)</span>
<a name="199" /><span class="False">     199:</span> <span class="f">{</span>
<a name="200" /><span class="False">     200:</span>     <span class="m">return</span> <a href="cpu.c_macros_ref.html#_cG1kX3ZhbF8w"><span class="b">pmd_val</span></a><span class="f">(</span><span class="b">pmd_a</span><span class="f">)</span> <span class="f">==</span> <a href="cpu.c_macros_ref.html#_cG1kX3ZhbF8w"><span class="b">pmd_val</span></a><span class="f">(</span><span class="b">pmd_b</span><span class="f">)</span><span class="f">;</span>
<a name="201" /><span class="False">     201:</span> <span class="f">}</span>
<a name="202" /><span class="True">     202:</span> <span class="f">#</span><span class="n">else</span> <span class="k">/* CONFIG_TRANSPARENT_HUGEPAGE */</span>
<a name="203" /><span class="True">     203:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_same</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd_a</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="b">pmd_b</span><span class="f">)</span>
<a name="204" /><span class="True">     204:</span> <span class="f">{</span>
<a name="205" /><span class="True">     205:</span>     <a href="cpu.c_macros_ref.html#_QlVHXzA_"><span class="b">BUG</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="206" /><span class="True">     206:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="207" /><span class="True">     207:</span> <span class="f">}</span>
<a name="208" /><span class="True">     208:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_TRANSPARENT_HUGEPAGE */</span>
<a name="209" /><span class="True">     209:</span> <span class="f">#</span><span class="n">endif</span>
<a name="210" /><span class="True">     210:</span> 
<a name="211" /><span class="True">     211:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_PGD_OFFSET_GATE</span>
<a name="212" /><span class="True">     212:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cGdkX29mZnNldF9nYXRlXzA_"><span class="b">pgd_offset_gate</span></a><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">addr</span><span class="f">)</span>    <a href="cpu.c_macros_noref.html#_cGdkX29mZnNldF8w"><span class="b">pgd_offset</span></a><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">addr</span><span class="f">)</span>
<a name="213" /><span class="True">     213:</span> <span class="f">#</span><span class="n">endif</span>
<a name="214" /><span class="True">     214:</span> 
<a name="215" /><span class="True">     215:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_MOVE_PTE</span>
<a name="216" /><span class="True">     216:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_bW92ZV9wdGVfMA__"><span class="b">move_pte</span></a><span class="f">(</span><span class="b">pte</span><span class="f">,</span> <span class="b">prot</span><span class="f">,</span> <span class="b">old_addr</span><span class="f">,</span> <span class="b">new_addr</span><span class="f">)</span>    <span class="f">(</span><span class="b">pte</span><span class="f">)</span>
<a name="217" /><span class="True">     217:</span> <span class="f">#</span><span class="n">endif</span>
<a name="218" /><span class="True">     218:</span> 
<a name="219" /><span class="False">     219:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_cHRlX2FjY2Vzc2libGVfMA__"><span class="b">pte_accessible</span></a>
<a name="220" /><span class="False">     220:</span> <span class="f">#</span> <span class="n">define</span> <a href="cpu.c_macros_ref.html#_cHRlX2FjY2Vzc2libGVfMA__"><span class="b">pte_accessible</span></a><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">pte</span><span class="f">)</span>    <span class="f">(</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="f">(</span><span class="b">pte</span><span class="f">)</span><span class="f">,</span> <span class="c">1</span><span class="f">)</span>
<a name="221" /><span class="True">     221:</span> <span class="f">#</span><span class="n">endif</span>
<a name="222" /><span class="True">     222:</span> 
<a name="223" /><span class="False">     223:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_Zmx1c2hfdGxiX2ZpeF9zcHVyaW91c19mYXVsdF8w"><span class="b">flush_tlb_fix_spurious_fault</span></a>
<a name="224" /><span class="False">     224:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_Zmx1c2hfdGxiX2ZpeF9zcHVyaW91c19mYXVsdF8w"><span class="b">flush_tlb_fix_spurious_fault</span></a><span class="f">(</span><span class="b">vma</span><span class="f">,</span> <span class="b">address</span><span class="f">)</span> <span class="b">flush_tlb_page</span><span class="f">(</span><span class="b">vma</span><span class="f">,</span> <span class="b">address</span><span class="f">)</span>
<a name="225" /><span class="True">     225:</span> <span class="f">#</span><span class="n">endif</span>
<a name="226" /><span class="True">     226:</span> 
<a name="227" /><span class="False">     227:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_cGdwcm90X25vbmNhY2hlZF8w"><span class="b">pgprot_noncached</span></a>
<a name="228" /><span class="False">     228:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cGdwcm90X25vbmNhY2hlZF8w"><span class="b">pgprot_noncached</span></a><span class="f">(</span><span class="b">prot</span><span class="f">)</span>    <span class="f">(</span><span class="b">prot</span><span class="f">)</span>
<a name="229" /><span class="True">     229:</span> <span class="f">#</span><span class="n">endif</span>
<a name="230" /><span class="True">     230:</span> 
<a name="231" /><span class="False">     231:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_cGdwcm90X3dyaXRlY29tYmluZV8w"><span class="b">pgprot_writecombine</span></a>
<a name="232" /><span class="False">     232:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_cGdwcm90X3dyaXRlY29tYmluZV8w"><span class="b">pgprot_writecombine</span></a> <a href="cpu.c_macros_ref.html#_cGdwcm90X25vbmNhY2hlZF8w"><span class="b">pgprot_noncached</span></a>
<a name="233" /><span class="True">     233:</span> <span class="f">#</span><span class="n">endif</span>
<a name="234" /><span class="True">     234:</span> 
<a name="235" /><span class="True">     235:</span> <span class="k">/*</span>
<a name="236" /><span class="True">     236:</span> <span class="k"> * When walking page tables, get the address of the next boundary,</span>
<a name="237" /><span class="True">     237:</span> <span class="k"> * or the end address of the range if that comes earlier.  Although no</span>
<a name="238" /><span class="True">     238:</span> <span class="k"> * vma end wraps to 0, rounded up __boundary may wrap to 0 throughout.</span>
<a name="239" /><span class="True">     239:</span> <span class="k"> */</span>
<a name="240" /><span class="True">     240:</span> 
<a name="241" /><span class="True">     241:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cGdkX2FkZHJfZW5kXzA_"><span class="b">pgd_addr_end</span></a><span class="f">(</span><span class="b">addr</span><span class="f">,</span> <span class="b">end</span><span class="f">)</span>                        \
<a name="242" /><span class="True">     242:</span> <span class="f">(</span><span class="f">{</span>    <span class="m">unsigned</span> <span class="m">long</span> <span class="b">__boundary</span> <span class="f">=</span> <span class="f">(</span><span class="f">(</span><span class="b">addr</span><span class="f">)</span> <span class="f">+</span> <a href="cpu.c_macros_noref.html#_UEdESVJfU0laRV8w"><span class="b">PGDIR_SIZE</span></a><span class="f">)</span> <span class="f">&amp;</span> <a href="cpu.c_macros_noref.html#_UEdESVJfTUFTS18w"><span class="b">PGDIR_MASK</span></a><span class="f">;</span>    \
<a name="243" /><span class="True">     243:</span>     <span class="f">(</span><span class="b">__boundary</span> <span class="f">-</span> <span class="c">1</span> <span class="f">&lt;</span> <span class="f">(</span><span class="b">end</span><span class="f">)</span> <span class="f">-</span> <span class="c">1</span><span class="f">)</span><span class="f">?</span> <span class="b">__boundary</span><span class="f">:</span> <span class="f">(</span><span class="b">end</span><span class="f">)</span><span class="f">;</span>        \
<a name="244" /><span class="True">     244:</span> <span class="f">}</span><span class="f">)</span>
<a name="245" /><span class="True">     245:</span> 
<a name="246" /><span class="True">     246:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_noref.html#_cHVkX2FkZHJfZW5kXzA_"><span class="b">pud_addr_end</span></a>
<a name="247" /><span class="True">     247:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHVkX2FkZHJfZW5kXzA_"><span class="b">pud_addr_end</span></a><span class="f">(</span><span class="b">addr</span><span class="f">,</span> <span class="b">end</span><span class="f">)</span>                        \
<a name="248" /><span class="True">     248:</span> <span class="f">(</span><span class="f">{</span>    <span class="m">unsigned</span> <span class="m">long</span> <span class="b">__boundary</span> <span class="f">=</span> <span class="f">(</span><span class="f">(</span><span class="b">addr</span><span class="f">)</span> <span class="f">+</span> <a href="cpu.c_macros_noref.html#_UFVEX1NJWkVfMA__"><span class="b">PUD_SIZE</span></a><span class="f">)</span> <span class="f">&amp;</span> <a href="cpu.c_macros_noref.html#_UFVEX01BU0tfMA__"><span class="b">PUD_MASK</span></a><span class="f">;</span>    \
<a name="249" /><span class="True">     249:</span>     <span class="f">(</span><span class="b">__boundary</span> <span class="f">-</span> <span class="c">1</span> <span class="f">&lt;</span> <span class="f">(</span><span class="b">end</span><span class="f">)</span> <span class="f">-</span> <span class="c">1</span><span class="f">)</span><span class="f">?</span> <span class="b">__boundary</span><span class="f">:</span> <span class="f">(</span><span class="b">end</span><span class="f">)</span><span class="f">;</span>        \
<a name="250" /><span class="True">     250:</span> <span class="f">}</span><span class="f">)</span>
<a name="251" /><span class="True">     251:</span> <span class="f">#</span><span class="n">endif</span>
<a name="252" /><span class="True">     252:</span> 
<a name="253" /><span class="True">     253:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_noref.html#_cG1kX2FkZHJfZW5kXzA_"><span class="b">pmd_addr_end</span></a>
<a name="254" /><span class="True">     254:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cG1kX2FkZHJfZW5kXzA_"><span class="b">pmd_addr_end</span></a><span class="f">(</span><span class="b">addr</span><span class="f">,</span> <span class="b">end</span><span class="f">)</span>                        \
<a name="255" /><span class="True">     255:</span> <span class="f">(</span><span class="f">{</span>    <span class="m">unsigned</span> <span class="m">long</span> <span class="b">__boundary</span> <span class="f">=</span> <span class="f">(</span><span class="f">(</span><span class="b">addr</span><span class="f">)</span> <span class="f">+</span> <a href="cpu.c_macros_noref.html#_UE1EX1NJWkVfMA__"><span class="b">PMD_SIZE</span></a><span class="f">)</span> <span class="f">&amp;</span> <a href="cpu.c_macros_noref.html#_UE1EX01BU0tfMA__"><span class="b">PMD_MASK</span></a><span class="f">;</span>    \
<a name="256" /><span class="True">     256:</span>     <span class="f">(</span><span class="b">__boundary</span> <span class="f">-</span> <span class="c">1</span> <span class="f">&lt;</span> <span class="f">(</span><span class="b">end</span><span class="f">)</span> <span class="f">-</span> <span class="c">1</span><span class="f">)</span><span class="f">?</span> <span class="b">__boundary</span><span class="f">:</span> <span class="f">(</span><span class="b">end</span><span class="f">)</span><span class="f">;</span>        \
<a name="257" /><span class="True">     257:</span> <span class="f">}</span><span class="f">)</span>
<a name="258" /><span class="True">     258:</span> <span class="f">#</span><span class="n">endif</span>
<a name="259" /><span class="True">     259:</span> 
<a name="260" /><span class="True">     260:</span> <span class="k">/*</span>
<a name="261" /><span class="True">     261:</span> <span class="k"> * When walking page tables, we usually want to skip any p?d_none entries;</span>
<a name="262" /><span class="True">     262:</span> <span class="k"> * and any p?d_bad entries - reporting the error before resetting to none.</span>
<a name="263" /><span class="True">     263:</span> <span class="k"> * Do the tests inline, but report and clear the bad entry in mm/memory.c.</span>
<a name="264" /><span class="True">     264:</span> <span class="k"> */</span>
<a name="265" /><span class="True">     265:</span> <span class="m">void</span> <span class="b">pgd_clear_bad</span><span class="f">(</span><span class="b">pgd_t</span> <span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="266" /><span class="True">     266:</span> <span class="m">void</span> <span class="b">pud_clear_bad</span><span class="f">(</span><span class="b">pud_t</span> <span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="267" /><span class="True">     267:</span> <span class="m">void</span> <span class="b">pmd_clear_bad</span><span class="f">(</span><span class="b">pmd_t</span> <span class="f">*</span><span class="f">)</span><span class="f">;</span>
<a name="268" /><span class="True">     268:</span> 
<a name="269" /><span class="True">     269:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pgd_none_or_clear_bad</span><span class="f">(</span><span class="b">pgd_t</span> <span class="f">*</span><span class="b">pgd</span><span class="f">)</span>
<a name="270" /><span class="True">     270:</span> <span class="f">{</span>
<a name="271" /><span class="True">     271:</span>     <span class="m">if</span> <span class="f">(</span><span class="b">pgd_none</span><span class="f">(</span><span class="f">*</span><span class="b">pgd</span><span class="f">)</span><span class="f">)</span>
<a name="272" /><span class="True">     272:</span>         <span class="m">return</span> <span class="c">1</span><span class="f">;</span>
<a name="273" /><span class="True">     273:</span>     <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_dW5saWtlbHlfMA__"><span class="b">unlikely</span></a><span class="f">(</span><span class="b">pgd_bad</span><span class="f">(</span><span class="f">*</span><span class="b">pgd</span><span class="f">)</span><span class="f">)</span><span class="f">)</span> <span class="f">{</span>
<a name="274" /><span class="True">     274:</span>         <span class="b">pgd_clear_bad</span><span class="f">(</span><span class="b">pgd</span><span class="f">)</span><span class="f">;</span>
<a name="275" /><span class="True">     275:</span>         <span class="m">return</span> <span class="c">1</span><span class="f">;</span>
<a name="276" /><span class="True">     276:</span>     <span class="f">}</span>
<a name="277" /><span class="True">     277:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="278" /><span class="True">     278:</span> <span class="f">}</span>
<a name="279" /><span class="True">     279:</span> 
<a name="280" /><span class="True">     280:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pud_none_or_clear_bad</span><span class="f">(</span><span class="b">pud_t</span> <span class="f">*</span><span class="b">pud</span><span class="f">)</span>
<a name="281" /><span class="True">     281:</span> <span class="f">{</span>
<a name="282" /><span class="True">     282:</span>     <span class="m">if</span> <span class="f">(</span><span class="b">pud_none</span><span class="f">(</span><span class="f">*</span><span class="b">pud</span><span class="f">)</span><span class="f">)</span>
<a name="283" /><span class="True">     283:</span>         <span class="m">return</span> <span class="c">1</span><span class="f">;</span>
<a name="284" /><span class="True">     284:</span>     <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_dW5saWtlbHlfMA__"><span class="b">unlikely</span></a><span class="f">(</span><span class="b">pud_bad</span><span class="f">(</span><span class="f">*</span><span class="b">pud</span><span class="f">)</span><span class="f">)</span><span class="f">)</span> <span class="f">{</span>
<a name="285" /><span class="True">     285:</span>         <span class="b">pud_clear_bad</span><span class="f">(</span><span class="b">pud</span><span class="f">)</span><span class="f">;</span>
<a name="286" /><span class="True">     286:</span>         <span class="m">return</span> <span class="c">1</span><span class="f">;</span>
<a name="287" /><span class="True">     287:</span>     <span class="f">}</span>
<a name="288" /><span class="True">     288:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="289" /><span class="True">     289:</span> <span class="f">}</span>
<a name="290" /><span class="True">     290:</span> 
<a name="291" /><span class="True">     291:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_none_or_clear_bad</span><span class="f">(</span><span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmd</span><span class="f">)</span>
<a name="292" /><span class="True">     292:</span> <span class="f">{</span>
<a name="293" /><span class="True">     293:</span>     <span class="m">if</span> <span class="f">(</span><span class="b">pmd_none</span><span class="f">(</span><span class="f">*</span><span class="b">pmd</span><span class="f">)</span><span class="f">)</span>
<a name="294" /><span class="True">     294:</span>         <span class="m">return</span> <span class="c">1</span><span class="f">;</span>
<a name="295" /><span class="True">     295:</span>     <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_dW5saWtlbHlfMA__"><span class="b">unlikely</span></a><span class="f">(</span><span class="b">pmd_bad</span><span class="f">(</span><span class="f">*</span><span class="b">pmd</span><span class="f">)</span><span class="f">)</span><span class="f">)</span> <span class="f">{</span>
<a name="296" /><span class="True">     296:</span>         <span class="b">pmd_clear_bad</span><span class="f">(</span><span class="b">pmd</span><span class="f">)</span><span class="f">;</span>
<a name="297" /><span class="True">     297:</span>         <span class="m">return</span> <span class="c">1</span><span class="f">;</span>
<a name="298" /><span class="True">     298:</span>     <span class="f">}</span>
<a name="299" /><span class="True">     299:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="300" /><span class="True">     300:</span> <span class="f">}</span>
<a name="301" /><span class="True">     301:</span> 
<a name="302" /><span class="True">     302:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">__ptep_modify_prot_start</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="303" /><span class="True">     303:</span>                          <span class="m">unsigned</span> <span class="m">long</span> <span class="b">addr</span><span class="f">,</span>
<a name="304" /><span class="True">     304:</span>                          <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">)</span>
<a name="305" /><span class="True">     305:</span> <span class="f">{</span>
<a name="306" /><span class="True">     306:</span>     <span class="k">/*</span>
<a name="307" /><span class="True">     307:</span> <span class="k">     * Get the current pte state, but zero it out to make it</span>
<a name="308" /><span class="True">     308:</span> <span class="k">     * non-present, preventing the hardware from asynchronously</span>
<a name="309" /><span class="True">     309:</span> <span class="k">     * updating it.</span>
<a name="310" /><span class="True">     310:</span> <span class="k">     */</span>
<a name="311" /><span class="True">     311:</span>     <span class="m">return</span> <span class="b">ptep_get_and_clear</span><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">addr</span><span class="f">,</span> <span class="b">ptep</span><span class="f">)</span><span class="f">;</span>
<a name="312" /><span class="True">     312:</span> <span class="f">}</span>
<a name="313" /><span class="True">     313:</span> 
<a name="314" /><span class="True">     314:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">__ptep_modify_prot_commit</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="315" /><span class="True">     315:</span>                          <span class="m">unsigned</span> <span class="m">long</span> <span class="b">addr</span><span class="f">,</span>
<a name="316" /><span class="True">     316:</span>                          <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">,</span> <span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="317" /><span class="True">     317:</span> <span class="f">{</span>
<a name="318" /><span class="True">     318:</span>     <span class="k">/*</span>
<a name="319" /><span class="True">     319:</span> <span class="k">     * The pte is non-present, so there&apos;s no hardware state to</span>
<a name="320" /><span class="True">     320:</span> <span class="k">     * preserve.</span>
<a name="321" /><span class="True">     321:</span> <span class="k">     */</span>
<a name="322" /><span class="True">     322:</span>     <a href="cpu.c_macros_ref.html#_c2V0X3B0ZV9hdF8w"><span class="b">set_pte_at</span></a><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">addr</span><span class="f">,</span> <span class="b">ptep</span><span class="f">,</span> <span class="b">pte</span><span class="f">)</span><span class="f">;</span>
<a name="323" /><span class="True">     323:</span> <span class="f">}</span>
<a name="324" /><span class="True">     324:</span> 
<a name="325" /><span class="True">     325:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION</span>
<a name="326" /><span class="True">     326:</span> <span class="k">/*</span>
<a name="327" /><span class="True">     327:</span> <span class="k"> * Start a pte protection read-modify-write transaction, which</span>
<a name="328" /><span class="True">     328:</span> <span class="k"> * protects against asynchronous hardware modifications to the pte.</span>
<a name="329" /><span class="True">     329:</span> <span class="k"> * The intention is not to prevent the hardware from making pte</span>
<a name="330" /><span class="True">     330:</span> <span class="k"> * updates, but to prevent any updates it may make from being lost.</span>
<a name="331" /><span class="True">     331:</span> <span class="k"> *</span>
<a name="332" /><span class="True">     332:</span> <span class="k"> * This does not protect against other software modifications of the</span>
<a name="333" /><span class="True">     333:</span> <span class="k"> * pte; the appropriate pte lock must be held over the transation.</span>
<a name="334" /><span class="True">     334:</span> <span class="k"> *</span>
<a name="335" /><span class="True">     335:</span> <span class="k"> * Note that this interface is intended to be batchable, meaning that</span>
<a name="336" /><span class="True">     336:</span> <span class="k"> * ptep_modify_prot_commit may not actually update the pte, but merely</span>
<a name="337" /><span class="True">     337:</span> <span class="k"> * queue the update to be done at some later time.  The update must be</span>
<a name="338" /><span class="True">     338:</span> <span class="k"> * actually committed before the pte lock is released, however.</span>
<a name="339" /><span class="True">     339:</span> <span class="k"> */</span>
<a name="340" /><span class="True">     340:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">ptep_modify_prot_start</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="341" /><span class="True">     341:</span>                        <span class="m">unsigned</span> <span class="m">long</span> <span class="b">addr</span><span class="f">,</span>
<a name="342" /><span class="True">     342:</span>                        <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">)</span>
<a name="343" /><span class="True">     343:</span> <span class="f">{</span>
<a name="344" /><span class="True">     344:</span>     <span class="m">return</span> <span class="b">__ptep_modify_prot_start</span><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">addr</span><span class="f">,</span> <span class="b">ptep</span><span class="f">)</span><span class="f">;</span>
<a name="345" /><span class="True">     345:</span> <span class="f">}</span>
<a name="346" /><span class="True">     346:</span> 
<a name="347" /><span class="True">     347:</span> <span class="k">/*</span>
<a name="348" /><span class="True">     348:</span> <span class="k"> * Commit an update to a pte, leaving any hardware-controlled bits in</span>
<a name="349" /><span class="True">     349:</span> <span class="k"> * the PTE unmodified.</span>
<a name="350" /><span class="True">     350:</span> <span class="k"> */</span>
<a name="351" /><span class="True">     351:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">ptep_modify_prot_commit</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span>
<a name="352" /><span class="True">     352:</span>                        <span class="m">unsigned</span> <span class="m">long</span> <span class="b">addr</span><span class="f">,</span>
<a name="353" /><span class="True">     353:</span>                        <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">,</span> <span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="354" /><span class="True">     354:</span> <span class="f">{</span>
<a name="355" /><span class="True">     355:</span>     <span class="b">__ptep_modify_prot_commit</span><span class="f">(</span><span class="b">mm</span><span class="f">,</span> <span class="b">addr</span><span class="f">,</span> <span class="b">ptep</span><span class="f">,</span> <span class="b">pte</span><span class="f">)</span><span class="f">;</span>
<a name="356" /><span class="True">     356:</span> <span class="f">}</span>
<a name="357" /><span class="True">     357:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* __HAVE_ARCH_PTEP_MODIFY_PROT_TRANSACTION */</span>
<a name="358" /><span class="True">     358:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_MMU */</span>
<a name="359" /><span class="True">     359:</span> 
<a name="360" /><span class="True">     360:</span> <span class="k">/*</span>
<a name="361" /><span class="True">     361:</span> <span class="k"> * A facility to provide lazy MMU batching.  This allows PTE updates and</span>
<a name="362" /><span class="True">     362:</span> <span class="k"> * page invalidations to be delayed until a call to leave lazy MMU mode</span>
<a name="363" /><span class="True">     363:</span> <span class="k"> * is issued.  Some architectures may benefit from doing this, and it is</span>
<a name="364" /><span class="True">     364:</span> <span class="k"> * beneficial for both shadow and direct mode hypervisors, which may batch</span>
<a name="365" /><span class="True">     365:</span> <span class="k"> * the PTE updates which happen during this window.  Note that using this</span>
<a name="366" /><span class="True">     366:</span> <span class="k"> * interface requires that read hazards be removed from the code.  A read</span>
<a name="367" /><span class="True">     367:</span> <span class="k"> * hazard could result in the direct mode hypervisor case, since the actual</span>
<a name="368" /><span class="True">     368:</span> <span class="k"> * write to the page tables may not yet have taken place, so reads though</span>
<a name="369" /><span class="True">     369:</span> <span class="k"> * a raw PTE pointer after it has been modified are not guaranteed to be</span>
<a name="370" /><span class="True">     370:</span> <span class="k"> * up to date.  This mode can only be entered and left under the protection of</span>
<a name="371" /><span class="True">     371:</span> <span class="k"> * the page table locks for all page tables which may be modified.  In the UP</span>
<a name="372" /><span class="True">     372:</span> <span class="k"> * case, this is required so that preemption is disabled, and in the SMP case,</span>
<a name="373" /><span class="True">     373:</span> <span class="k"> * it must synchronize the delayed page table writes properly on other CPUs.</span>
<a name="374" /><span class="True">     374:</span> <span class="k"> */</span>
<a name="375" /><span class="True">     375:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_ENTER_LAZY_MMU_MODE</span>
<a name="376" /><span class="True">     376:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_YXJjaF9lbnRlcl9sYXp5X21tdV9tb2RlXzA_"><span class="b">arch_enter_lazy_mmu_mode</span></a><span class="f">(</span><span class="f">)</span>    <span class="m">do</span> <span class="f">{</span><span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="377" /><span class="True">     377:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_YXJjaF9sZWF2ZV9sYXp5X21tdV9tb2RlXzA_"><span class="b">arch_leave_lazy_mmu_mode</span></a><span class="f">(</span><span class="f">)</span>    <span class="m">do</span> <span class="f">{</span><span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="378" /><span class="True">     378:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_YXJjaF9mbHVzaF9sYXp5X21tdV9tb2RlXzA_"><span class="b">arch_flush_lazy_mmu_mode</span></a><span class="f">(</span><span class="f">)</span>    <span class="m">do</span> <span class="f">{</span><span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="379" /><span class="True">     379:</span> <span class="f">#</span><span class="n">endif</span>
<a name="380" /><span class="True">     380:</span> 
<a name="381" /><span class="True">     381:</span> <span class="k">/*</span>
<a name="382" /><span class="True">     382:</span> <span class="k"> * A facility to provide batching of the reload of page tables and</span>
<a name="383" /><span class="True">     383:</span> <span class="k"> * other process state with the actual context switch code for</span>
<a name="384" /><span class="True">     384:</span> <span class="k"> * paravirtualized guests.  By convention, only one of the batched</span>
<a name="385" /><span class="True">     385:</span> <span class="k"> * update (lazy) modes (CPU, MMU) should be active at any given time,</span>
<a name="386" /><span class="True">     386:</span> <span class="k"> * entry should never be nested, and entry and exits should always be</span>
<a name="387" /><span class="True">     387:</span> <span class="k"> * paired.  This is for sanity of maintaining and reasoning about the</span>
<a name="388" /><span class="True">     388:</span> <span class="k"> * kernel code.  In this case, the exit (end of the context switch) is</span>
<a name="389" /><span class="True">     389:</span> <span class="k"> * in architecture-specific code, and so doesn&apos;t need a generic</span>
<a name="390" /><span class="True">     390:</span> <span class="k"> * definition.</span>
<a name="391" /><span class="True">     391:</span> <span class="k"> */</span>
<a name="392" /><span class="True">     392:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__HAVE_ARCH_START_CONTEXT_SWITCH</span>
<a name="393" /><span class="True">     393:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_YXJjaF9zdGFydF9jb250ZXh0X3N3aXRjaF8w"><span class="b">arch_start_context_switch</span></a><span class="f">(</span><span class="b">prev</span><span class="f">)</span>    <span class="m">do</span> <span class="f">{</span><span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="394" /><span class="True">     394:</span> <span class="f">#</span><span class="n">endif</span>
<a name="395" /><span class="True">     395:</span> 
<a name="396" /><span class="False">     396:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX0hBVkVfQVJDSF9TT0ZUX0RJUlRZXzA_"><span class="b">CONFIG_HAVE_ARCH_SOFT_DIRTY</span></a>
<a name="397" /><span class="False">     397:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pte_soft_dirty</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="398" /><span class="False">     398:</span> <span class="f">{</span>
<a name="399" /><span class="False">     399:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="400" /><span class="False">     400:</span> <span class="f">}</span>
<a name="401" /><span class="False">     401:</span> 
<a name="402" /><span class="False">     402:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_soft_dirty</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="403" /><span class="False">     403:</span> <span class="f">{</span>
<a name="404" /><span class="False">     404:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="405" /><span class="False">     405:</span> <span class="f">}</span>
<a name="406" /><span class="False">     406:</span> 
<a name="407" /><span class="False">     407:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">pte_mksoft_dirty</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="408" /><span class="False">     408:</span> <span class="f">{</span>
<a name="409" /><span class="False">     409:</span>     <span class="m">return</span> <span class="b">pte</span><span class="f">;</span>
<a name="410" /><span class="False">     410:</span> <span class="f">}</span>
<a name="411" /><span class="False">     411:</span> 
<a name="412" /><span class="False">     412:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pmd_t</span> <span class="b">pmd_mksoft_dirty</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="413" /><span class="False">     413:</span> <span class="f">{</span>
<a name="414" /><span class="False">     414:</span>     <span class="m">return</span> <span class="b">pmd</span><span class="f">;</span>
<a name="415" /><span class="False">     415:</span> <span class="f">}</span>
<a name="416" /><span class="False">     416:</span> 
<a name="417" /><span class="False">     417:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">pte_swp_mksoft_dirty</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="418" /><span class="False">     418:</span> <span class="f">{</span>
<a name="419" /><span class="False">     419:</span>     <span class="m">return</span> <span class="b">pte</span><span class="f">;</span>
<a name="420" /><span class="False">     420:</span> <span class="f">}</span>
<a name="421" /><span class="False">     421:</span> 
<a name="422" /><span class="False">     422:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pte_swp_soft_dirty</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="423" /><span class="False">     423:</span> <span class="f">{</span>
<a name="424" /><span class="False">     424:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="425" /><span class="False">     425:</span> <span class="f">}</span>
<a name="426" /><span class="False">     426:</span> 
<a name="427" /><span class="False">     427:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">pte_swp_clear_soft_dirty</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="428" /><span class="False">     428:</span> <span class="f">{</span>
<a name="429" /><span class="False">     429:</span>     <span class="m">return</span> <span class="b">pte</span><span class="f">;</span>
<a name="430" /><span class="False">     430:</span> <span class="f">}</span>
<a name="431" /><span class="False">     431:</span> 
<a name="432" /><span class="False">     432:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">pte_file_clear_soft_dirty</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="433" /><span class="False">     433:</span> <span class="f">{</span>
<a name="434" /><span class="False">     434:</span>        <span class="m">return</span> <span class="b">pte</span><span class="f">;</span>
<a name="435" /><span class="False">     435:</span> <span class="f">}</span>
<a name="436" /><span class="False">     436:</span> 
<a name="437" /><span class="False">     437:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">pte_file_mksoft_dirty</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="438" /><span class="False">     438:</span> <span class="f">{</span>
<a name="439" /><span class="False">     439:</span>        <span class="m">return</span> <span class="b">pte</span><span class="f">;</span>
<a name="440" /><span class="False">     440:</span> <span class="f">}</span>
<a name="441" /><span class="False">     441:</span> 
<a name="442" /><span class="False">     442:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pte_file_soft_dirty</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="443" /><span class="False">     443:</span> <span class="f">{</span>
<a name="444" /><span class="False">     444:</span>        <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="445" /><span class="False">     445:</span> <span class="f">}</span>
<a name="446" /><span class="True">     446:</span> <span class="f">#</span><span class="n">endif</span>
<a name="447" /><span class="True">     447:</span> 
<a name="448" /><span class="False">     448:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX1BGTk1BUF9UUkFDS0lOR18w"><span class="b">__HAVE_PFNMAP_TRACKING</span></a>
<a name="449" /><span class="False">     449:</span> <span class="k">/*</span>
<a name="450" /><span class="False">     450:</span> <span class="k"> * Interfaces that can be used by architecture code to keep track of</span>
<a name="451" /><span class="False">     451:</span> <span class="k"> * memory type of pfn mappings specified by the remap_pfn_range,</span>
<a name="452" /><span class="False">     452:</span> <span class="k"> * vm_insert_pfn.</span>
<a name="453" /><span class="False">     453:</span> <span class="k"> */</span>
<a name="454" /><span class="False">     454:</span> 
<a name="455" /><span class="False">     455:</span> <span class="k">/*</span>
<a name="456" /><span class="False">     456:</span> <span class="k"> * track_pfn_remap is called when a _new_ pfn mapping is being established</span>
<a name="457" /><span class="False">     457:</span> <span class="k"> * by remap_pfn_range() for physical range indicated by pfn and size.</span>
<a name="458" /><span class="False">     458:</span> <span class="k"> */</span>
<a name="459" /><span class="False">     459:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">track_pfn_remap</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span> <span class="b">pgprot_t</span> <span class="f">*</span><span class="b">prot</span><span class="f">,</span>
<a name="460" /><span class="False">     460:</span>                   <span class="m">unsigned</span> <span class="m">long</span> <span class="b">pfn</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">addr</span><span class="f">,</span>
<a name="461" /><span class="False">     461:</span>                   <span class="m">unsigned</span> <span class="m">long</span> <span class="b">size</span><span class="f">)</span>
<a name="462" /><span class="False">     462:</span> <span class="f">{</span>
<a name="463" /><span class="False">     463:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="464" /><span class="False">     464:</span> <span class="f">}</span>
<a name="465" /><span class="False">     465:</span> 
<a name="466" /><span class="False">     466:</span> <span class="k">/*</span>
<a name="467" /><span class="False">     467:</span> <span class="k"> * track_pfn_insert is called when a _new_ single pfn is established</span>
<a name="468" /><span class="False">     468:</span> <span class="k"> * by vm_insert_pfn().</span>
<a name="469" /><span class="False">     469:</span> <span class="k"> */</span>
<a name="470" /><span class="False">     470:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">track_pfn_insert</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span> <span class="b">pgprot_t</span> <span class="f">*</span><span class="b">prot</span><span class="f">,</span>
<a name="471" /><span class="False">     471:</span>                    <span class="m">unsigned</span> <span class="m">long</span> <span class="b">pfn</span><span class="f">)</span>
<a name="472" /><span class="False">     472:</span> <span class="f">{</span>
<a name="473" /><span class="False">     473:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="474" /><span class="False">     474:</span> <span class="f">}</span>
<a name="475" /><span class="False">     475:</span> 
<a name="476" /><span class="False">     476:</span> <span class="k">/*</span>
<a name="477" /><span class="False">     477:</span> <span class="k"> * track_pfn_copy is called when vma that is covering the pfnmap gets</span>
<a name="478" /><span class="False">     478:</span> <span class="k"> * copied through copy_page_range().</span>
<a name="479" /><span class="False">     479:</span> <span class="k"> */</span>
<a name="480" /><span class="False">     480:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">track_pfn_copy</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">)</span>
<a name="481" /><span class="False">     481:</span> <span class="f">{</span>
<a name="482" /><span class="False">     482:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="483" /><span class="False">     483:</span> <span class="f">}</span>
<a name="484" /><span class="False">     484:</span> 
<a name="485" /><span class="False">     485:</span> <span class="k">/*</span>
<a name="486" /><span class="False">     486:</span> <span class="k"> * untrack_pfn_vma is called while unmapping a pfnmap for a region.</span>
<a name="487" /><span class="False">     487:</span> <span class="k"> * untrack can be called for a specific region indicated by pfn and size or</span>
<a name="488" /><span class="False">     488:</span> <span class="k"> * can be for the entire vma (in which case pfn, size are zero).</span>
<a name="489" /><span class="False">     489:</span> <span class="k"> */</span>
<a name="490" /><span class="False">     490:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">untrack_pfn</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span>
<a name="491" /><span class="False">     491:</span>                    <span class="m">unsigned</span> <span class="m">long</span> <span class="b">pfn</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">size</span><span class="f">)</span>
<a name="492" /><span class="False">     492:</span> <span class="f">{</span>
<a name="493" /><span class="False">     493:</span> <span class="f">}</span>
<a name="494" /><span class="True">     494:</span> <span class="f">#</span><span class="n">else</span>
<a name="495" /><span class="True">     495:</span> <span class="m">extern</span> <span class="m">int</span> <span class="b">track_pfn_remap</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span> <span class="b">pgprot_t</span> <span class="f">*</span><span class="b">prot</span><span class="f">,</span>
<a name="496" /><span class="True">     496:</span>                <span class="m">unsigned</span> <span class="m">long</span> <span class="b">pfn</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">addr</span><span class="f">,</span>
<a name="497" /><span class="True">     497:</span>                <span class="m">unsigned</span> <span class="m">long</span> <span class="b">size</span><span class="f">)</span><span class="f">;</span>
<a name="498" /><span class="True">     498:</span> <span class="m">extern</span> <span class="m">int</span> <span class="b">track_pfn_insert</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span> <span class="b">pgprot_t</span> <span class="f">*</span><span class="b">prot</span><span class="f">,</span>
<a name="499" /><span class="True">     499:</span>                 <span class="m">unsigned</span> <span class="m">long</span> <span class="b">pfn</span><span class="f">)</span><span class="f">;</span>
<a name="500" /><span class="True">     500:</span> <span class="m">extern</span> <span class="m">int</span> <span class="b">track_pfn_copy</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">)</span><span class="f">;</span>
<a name="501" /><span class="True">     501:</span> <span class="m">extern</span> <span class="m">void</span> <span class="b">untrack_pfn</span><span class="f">(</span><span class="m">struct</span> <span class="b">vm_area_struct</span> <span class="f">*</span><span class="b">vma</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">pfn</span><span class="f">,</span>
<a name="502" /><span class="True">     502:</span>             <span class="m">unsigned</span> <span class="m">long</span> <span class="b">size</span><span class="f">)</span><span class="f">;</span>
<a name="503" /><span class="True">     503:</span> <span class="f">#</span><span class="n">endif</span>
<a name="504" /><span class="True">     504:</span> 
<a name="505" /><span class="False">     505:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">__HAVE_COLOR_ZERO_PAGE</span>
<a name="506" /><span class="False">     506:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">is_zero_pfn</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">pfn</span><span class="f">)</span>
<a name="507" /><span class="False">     507:</span> <span class="f">{</span>
<a name="508" /><span class="False">     508:</span>     <span class="m">extern</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">zero_pfn</span><span class="f">;</span>
<a name="509" /><span class="False">     509:</span>     <span class="m">unsigned</span> <span class="m">long</span> <span class="b">offset_from_zero_pfn</span> <span class="f">=</span> <span class="b">pfn</span> <span class="f">-</span> <span class="b">zero_pfn</span><span class="f">;</span>
<a name="510" /><span class="False">     510:</span>     <span class="m">return</span> <span class="b">offset_from_zero_pfn</span> <span class="f">&lt;=</span> <span class="f">(</span><span class="b">zero_page_mask</span> <span class="f">&gt;&gt;</span> <a href="cpu.c_macros_ref.html#_UEFHRV9TSElGVF8w"><span class="b">PAGE_SHIFT</span></a><span class="f">)</span><span class="f">;</span>
<a name="511" /><span class="False">     511:</span> <span class="f">}</span>
<a name="512" /><span class="False">     512:</span> 
<a name="513" /><span class="False">     513:</span> <span class="f">#</span><span class="n">define</span> <span class="b">my_zero_pfn</span><span class="f">(</span><span class="b">addr</span><span class="f">)</span>    <a href="cpu.c_macros_ref.html#_cGFnZV90b19wZm5fMA__"><span class="b">page_to_pfn</span></a><span class="f">(</span><a href="cpu.c_macros_noref.html#_WkVST19QQUdFXzA_"><span class="b">ZERO_PAGE</span></a><span class="f">(</span><span class="b">addr</span><span class="f">)</span><span class="f">)</span>
<a name="514" /><span class="False">     514:</span> 
<a name="515" /><span class="True">     515:</span> <span class="f">#</span><span class="n">else</span>
<a name="516" /><span class="True">     516:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">is_zero_pfn</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">pfn</span><span class="f">)</span>
<a name="517" /><span class="True">     517:</span> <span class="f">{</span>
<a name="518" /><span class="True">     518:</span>     <span class="m">extern</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">zero_pfn</span><span class="f">;</span>
<a name="519" /><span class="True">     519:</span>     <span class="m">return</span> <span class="b">pfn</span> <span class="f">==</span> <span class="b">zero_pfn</span><span class="f">;</span>
<a name="520" /><span class="True">     520:</span> <span class="f">}</span>
<a name="521" /><span class="True">     521:</span> 
<a name="522" /><span class="True">     522:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">my_zero_pfn</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">addr</span><span class="f">)</span>
<a name="523" /><span class="True">     523:</span> <span class="f">{</span>
<a name="524" /><span class="True">     524:</span>     <span class="m">extern</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">zero_pfn</span><span class="f">;</span>
<a name="525" /><span class="True">     525:</span>     <span class="m">return</span> <span class="b">zero_pfn</span><span class="f">;</span>
<a name="526" /><span class="True">     526:</span> <span class="f">}</span>
<a name="527" /><span class="True">     527:</span> <span class="f">#</span><span class="n">endif</span>
<a name="528" /><span class="True">     528:</span> 
<a name="529" /><span class="True">     529:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX01NVV8w"><span class="b">CONFIG_MMU</span></a>
<a name="530" /><span class="True">     530:</span> 
<a name="531" /><span class="True">     531:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">CONFIG_TRANSPARENT_HUGEPAGE</span>
<a name="532" /><span class="True">     532:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_trans_huge</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="533" /><span class="True">     533:</span> <span class="f">{</span>
<a name="534" /><span class="True">     534:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="535" /><span class="True">     535:</span> <span class="f">}</span>
<a name="536" /><span class="True">     536:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_trans_splitting</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="537" /><span class="True">     537:</span> <span class="f">{</span>
<a name="538" /><span class="True">     538:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="539" /><span class="True">     539:</span> <span class="f">}</span>
<a name="540" /><span class="False">     540:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUE1EX1dSSVRFXzA_"><span class="b">__HAVE_ARCH_PMD_WRITE</span></a>
<a name="541" /><span class="False">     541:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_write</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="542" /><span class="False">     542:</span> <span class="f">{</span>
<a name="543" /><span class="False">     543:</span>     <a href="cpu.c_macros_ref.html#_QlVHXzA_"><span class="b">BUG</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="544" /><span class="False">     544:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="545" /><span class="False">     545:</span> <span class="f">}</span>
<a name="546" /><span class="True">     546:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* __HAVE_ARCH_PMD_WRITE */</span>
<a name="547" /><span class="True">     547:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_TRANSPARENT_HUGEPAGE */</span>
<a name="548" /><span class="True">     548:</span> 
<a name="549" /><span class="True">     549:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">pmd_read_atomic</span>
<a name="550" /><span class="True">     550:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pmd_t</span> <span class="b">pmd_read_atomic</span><span class="f">(</span><span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">)</span>
<a name="551" /><span class="True">     551:</span> <span class="f">{</span>
<a name="552" /><span class="True">     552:</span>     <span class="k">/*</span>
<a name="553" /><span class="True">     553:</span> <span class="k">     * Depend on compiler for an atomic pmd read. NOTE: this is</span>
<a name="554" /><span class="True">     554:</span> <span class="k">     * only going to work, if the pmdval_t isn&apos;t larger than</span>
<a name="555" /><span class="True">     555:</span> <span class="k">     * an unsigned long.</span>
<a name="556" /><span class="True">     556:</span> <span class="k">     */</span>
<a name="557" /><span class="True">     557:</span>     <span class="m">return</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">;</span>
<a name="558" /><span class="True">     558:</span> <span class="f">}</span>
<a name="559" /><span class="True">     559:</span> <span class="f">#</span><span class="n">endif</span>
<a name="560" /><span class="True">     560:</span> 
<a name="561" /><span class="True">     561:</span> <span class="k">/*</span>
<a name="562" /><span class="True">     562:</span> <span class="k"> * This function is meant to be used by sites walking pagetables with</span>
<a name="563" /><span class="True">     563:</span> <span class="k"> * the mmap_sem hold in read mode to protect against MADV_DONTNEED and</span>
<a name="564" /><span class="True">     564:</span> <span class="k"> * transhuge page faults. MADV_DONTNEED can convert a transhuge pmd</span>
<a name="565" /><span class="True">     565:</span> <span class="k"> * into a null pmd and the transhuge page fault can convert a null pmd</span>
<a name="566" /><span class="True">     566:</span> <span class="k"> * into an hugepmd or into a regular pmd (if the hugepage allocation</span>
<a name="567" /><span class="True">     567:</span> <span class="k"> * fails). While holding the mmap_sem in read mode the pmd becomes</span>
<a name="568" /><span class="True">     568:</span> <span class="k"> * stable and stops changing under us only if it&apos;s not null and not a</span>
<a name="569" /><span class="True">     569:</span> <span class="k"> * transhuge pmd. When those races occurs and this function makes a</span>
<a name="570" /><span class="True">     570:</span> <span class="k"> * difference vs the standard pmd_none_or_clear_bad, the result is</span>
<a name="571" /><span class="True">     571:</span> <span class="k"> * undefined so behaving like if the pmd was none is safe (because it</span>
<a name="572" /><span class="True">     572:</span> <span class="k"> * can return none anyway). The compiler level barrier() is critically</span>
<a name="573" /><span class="True">     573:</span> <span class="k"> * important to compute the two checks atomically on the same pmdval.</span>
<a name="574" /><span class="True">     574:</span> <span class="k"> *</span>
<a name="575" /><span class="True">     575:</span> <span class="k"> * For 32bit kernels with a 64bit large pmd_t this automatically takes</span>
<a name="576" /><span class="True">     576:</span> <span class="k"> * care of reading the pmd atomically to avoid SMP race conditions</span>
<a name="577" /><span class="True">     577:</span> <span class="k"> * against pmd_populate() when the mmap_sem is hold for reading by the</span>
<a name="578" /><span class="True">     578:</span> <span class="k"> * caller (a special atomic read not done by &quot;gcc&quot; as in the generic</span>
<a name="579" /><span class="True">     579:</span> <span class="k"> * version above, is also needed when THP is disabled because the page</span>
<a name="580" /><span class="True">     580:</span> <span class="k"> * fault can populate the pmd from under us).</span>
<a name="581" /><span class="True">     581:</span> <span class="k"> */</span>
<a name="582" /><span class="True">     582:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_none_or_trans_huge_or_clear_bad</span><span class="f">(</span><span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmd</span><span class="f">)</span>
<a name="583" /><span class="True">     583:</span> <span class="f">{</span>
<a name="584" /><span class="True">     584:</span>     <span class="b">pmd_t</span> <span class="b">pmdval</span> <span class="f">=</span> <span class="b">pmd_read_atomic</span><span class="f">(</span><span class="b">pmd</span><span class="f">)</span><span class="f">;</span>
<a name="585" /><span class="True">     585:</span>     <span class="k">/*</span>
<a name="586" /><span class="True">     586:</span> <span class="k">     * The barrier will stabilize the pmdval in a register or on</span>
<a name="587" /><span class="True">     587:</span> <span class="k">     * the stack so that it will stop changing under the code.</span>
<a name="588" /><span class="True">     588:</span> <span class="k">     *</span>
<a name="589" /><span class="True">     589:</span> <span class="k">     * When CONFIG_TRANSPARENT_HUGEPAGE=y on x86 32bit PAE,</span>
<a name="590" /><span class="True">     590:</span> <span class="k">     * pmd_read_atomic is allowed to return a not atomic pmdval</span>
<a name="591" /><span class="True">     591:</span> <span class="k">     * (for example pointing to an hugepage that has never been</span>
<a name="592" /><span class="True">     592:</span> <span class="k">     * mapped in the pmd). The below checks will only care about</span>
<a name="593" /><span class="True">     593:</span> <span class="k">     * the low part of the pmd with 32bit PAE x86 anyway, with the</span>
<a name="594" /><span class="True">     594:</span> <span class="k">     * exception of pmd_none(). So the important thing is that if</span>
<a name="595" /><span class="True">     595:</span> <span class="k">     * the low part of the pmd is found null, the high part will</span>
<a name="596" /><span class="True">     596:</span> <span class="k">     * be also null or the pmd_none() check below would be</span>
<a name="597" /><span class="True">     597:</span> <span class="k">     * confused.</span>
<a name="598" /><span class="True">     598:</span> <span class="k">     */</span>
<a name="599" /><span class="False">     599:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_TRANSPARENT_HUGEPAGE</span>
<a name="600" /><span class="False">     600:</span>     <a href="cpu.c_macros_ref.html#_YmFycmllcl8w"><span class="b">barrier</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="601" /><span class="True">     601:</span> <span class="f">#</span><span class="n">endif</span>
<a name="602" /><span class="True">     602:</span>     <span class="m">if</span> <span class="f">(</span><span class="b">pmd_none</span><span class="f">(</span><span class="b">pmdval</span><span class="f">)</span> <span class="f">||</span> <span class="b">pmd_trans_huge</span><span class="f">(</span><span class="b">pmdval</span><span class="f">)</span><span class="f">)</span>
<a name="603" /><span class="True">     603:</span>         <span class="m">return</span> <span class="c">1</span><span class="f">;</span>
<a name="604" /><span class="True">     604:</span>     <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_dW5saWtlbHlfMA__"><span class="b">unlikely</span></a><span class="f">(</span><span class="b">pmd_bad</span><span class="f">(</span><span class="b">pmdval</span><span class="f">)</span><span class="f">)</span><span class="f">)</span> <span class="f">{</span>
<a name="605" /><span class="True">     605:</span>         <span class="b">pmd_clear_bad</span><span class="f">(</span><span class="b">pmd</span><span class="f">)</span><span class="f">;</span>
<a name="606" /><span class="True">     606:</span>         <span class="m">return</span> <span class="c">1</span><span class="f">;</span>
<a name="607" /><span class="True">     607:</span>     <span class="f">}</span>
<a name="608" /><span class="True">     608:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="609" /><span class="True">     609:</span> <span class="f">}</span>
<a name="610" /><span class="True">     610:</span> 
<a name="611" /><span class="True">     611:</span> <span class="k">/*</span>
<a name="612" /><span class="True">     612:</span> <span class="k"> * This is a noop if Transparent Hugepage Support is not built into</span>
<a name="613" /><span class="True">     613:</span> <span class="k"> * the kernel. Otherwise it is equivalent to</span>
<a name="614" /><span class="True">     614:</span> <span class="k"> * pmd_none_or_trans_huge_or_clear_bad(), and shall only be called in</span>
<a name="615" /><span class="True">     615:</span> <span class="k"> * places that already verified the pmd is not none and they want to</span>
<a name="616" /><span class="True">     616:</span> <span class="k"> * walk ptes while holding the mmap sem in read mode (write mode don&apos;t</span>
<a name="617" /><span class="True">     617:</span> <span class="k"> * need this). If THP is not enabled, the pmd can&apos;t go away under the</span>
<a name="618" /><span class="True">     618:</span> <span class="k"> * code even if MADV_DONTNEED runs, but if THP is enabled we need to</span>
<a name="619" /><span class="True">     619:</span> <span class="k"> * run a pmd_trans_unstable before walking the ptes after</span>
<a name="620" /><span class="True">     620:</span> <span class="k"> * split_huge_page_pmd returns (because it may have run when the pmd</span>
<a name="621" /><span class="True">     621:</span> <span class="k"> * become null, but then a page fault can map in a THP and not a</span>
<a name="622" /><span class="True">     622:</span> <span class="k"> * regular page).</span>
<a name="623" /><span class="True">     623:</span> <span class="k"> */</span>
<a name="624" /><span class="True">     624:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_trans_unstable</span><span class="f">(</span><span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmd</span><span class="f">)</span>
<a name="625" /><span class="True">     625:</span> <span class="f">{</span>
<a name="626" /><span class="False">     626:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_TRANSPARENT_HUGEPAGE</span>
<a name="627" /><span class="False">     627:</span>     <span class="m">return</span> <span class="b">pmd_none_or_trans_huge_or_clear_bad</span><span class="f">(</span><span class="b">pmd</span><span class="f">)</span><span class="f">;</span>
<a name="628" /><span class="True">     628:</span> <span class="f">#</span><span class="n">else</span>
<a name="629" /><span class="True">     629:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="630" /><span class="True">     630:</span> <span class="f">#</span><span class="n">endif</span>
<a name="631" /><span class="True">     631:</span> <span class="f">}</span>
<a name="632" /><span class="True">     632:</span> 
<a name="633" /><span class="False">     633:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_NUMA_BALANCING</span>
<a name="634" /><span class="False">     634:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_ARCH_USES_NUMA_PROT_NONE</span>
<a name="635" /><span class="False">     635:</span> <span class="k">/*</span>
<a name="636" /><span class="False">     636:</span> <span class="k"> * _PAGE_NUMA works identical to _PAGE_PROTNONE (it&apos;s actually the</span>
<a name="637" /><span class="False">     637:</span> <span class="k"> * same bit too). It&apos;s set only when _PAGE_PRESET is not set and it&apos;s</span>
<a name="638" /><span class="False">     638:</span> <span class="k"> * never set if _PAGE_PRESENT is set.</span>
<a name="639" /><span class="False">     639:</span> <span class="k"> *</span>
<a name="640" /><span class="False">     640:</span> <span class="k"> * pte/pmd_present() returns true if pte/pmd_numa returns true. Page</span>
<a name="641" /><span class="False">     641:</span> <span class="k"> * fault triggers on those regions if pte/pmd_numa returns true</span>
<a name="642" /><span class="False">     642:</span> <span class="k"> * (because _PAGE_PRESENT is not set).</span>
<a name="643" /><span class="False">     643:</span> <span class="k"> */</span>
<a name="644" /><span class="False">     644:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">pte_numa</span>
<a name="645" /><span class="False">     645:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pte_numa</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="646" /><span class="False">     646:</span> <span class="f">{</span>
<a name="647" /><span class="False">     647:</span>     <span class="m">return</span> <span class="f">(</span><span class="b">pte_flags</span><span class="f">(</span><span class="b">pte</span><span class="f">)</span> <span class="f">&amp;</span>
<a name="648" /><span class="False">     648:</span>         <span class="f">(</span><a href="cpu.c_macros_ref.html#_X1BBR0VfTlVNQV8w"><span class="b">_PAGE_NUMA</span></a><span class="f">|</span><a href="cpu.c_macros_ref.html#_X1BBR0VfUFJFU0VOVF8w"><span class="b">_PAGE_PRESENT</span></a><span class="f">)</span><span class="f">)</span> <span class="f">==</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfTlVNQV8w"><span class="b">_PAGE_NUMA</span></a><span class="f">;</span>
<a name="649" /><span class="False">     649:</span> <span class="f">}</span>
<a name="650" /><span class="False">     650:</span> <span class="f">#</span><span class="n">endif</span>
<a name="651" /><span class="False">     651:</span> 
<a name="652" /><span class="False">     652:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">pmd_numa</span>
<a name="653" /><span class="False">     653:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_numa</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="654" /><span class="False">     654:</span> <span class="f">{</span>
<a name="655" /><span class="False">     655:</span>     <span class="m">return</span> <span class="f">(</span><span class="b">pmd_flags</span><span class="f">(</span><span class="b">pmd</span><span class="f">)</span> <span class="f">&amp;</span>
<a name="656" /><span class="False">     656:</span>         <span class="f">(</span><a href="cpu.c_macros_ref.html#_X1BBR0VfTlVNQV8w"><span class="b">_PAGE_NUMA</span></a><span class="f">|</span><a href="cpu.c_macros_ref.html#_X1BBR0VfUFJFU0VOVF8w"><span class="b">_PAGE_PRESENT</span></a><span class="f">)</span><span class="f">)</span> <span class="f">==</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfTlVNQV8w"><span class="b">_PAGE_NUMA</span></a><span class="f">;</span>
<a name="657" /><span class="False">     657:</span> <span class="f">}</span>
<a name="658" /><span class="False">     658:</span> <span class="f">#</span><span class="n">endif</span>
<a name="659" /><span class="False">     659:</span> 
<a name="660" /><span class="False">     660:</span> <span class="k">/*</span>
<a name="661" /><span class="False">     661:</span> <span class="k"> * pte/pmd_mknuma sets the _PAGE_ACCESSED bitflag automatically</span>
<a name="662" /><span class="False">     662:</span> <span class="k"> * because they&apos;re called by the NUMA hinting minor page fault. If we</span>
<a name="663" /><span class="False">     663:</span> <span class="k"> * wouldn&apos;t set the _PAGE_ACCESSED bitflag here, the TLB miss handler</span>
<a name="664" /><span class="False">     664:</span> <span class="k"> * would be forced to set it later while filling the TLB after we</span>
<a name="665" /><span class="False">     665:</span> <span class="k"> * return to userland. That would trigger a second write to memory</span>
<a name="666" /><span class="False">     666:</span> <span class="k"> * that we optimize away by setting _PAGE_ACCESSED here.</span>
<a name="667" /><span class="False">     667:</span> <span class="k"> */</span>
<a name="668" /><span class="False">     668:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">pte_mknonnuma</span>
<a name="669" /><span class="False">     669:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">pte_mknonnuma</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="670" /><span class="False">     670:</span> <span class="f">{</span>
<a name="671" /><span class="False">     671:</span>     <span class="b">pte</span> <span class="f">=</span> <span class="b">pte_clear_flags</span><span class="f">(</span><span class="b">pte</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfTlVNQV8w"><span class="b">_PAGE_NUMA</span></a><span class="f">)</span><span class="f">;</span>
<a name="672" /><span class="False">     672:</span>     <span class="m">return</span> <span class="b">pte_set_flags</span><span class="f">(</span><span class="b">pte</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfUFJFU0VOVF8w"><span class="b">_PAGE_PRESENT</span></a><span class="f">|</span><a href="cpu.c_macros_ref.html#_X1BBR0VfQUNDRVNTRURfMA__"><span class="b">_PAGE_ACCESSED</span></a><span class="f">)</span><span class="f">;</span>
<a name="673" /><span class="False">     673:</span> <span class="f">}</span>
<a name="674" /><span class="False">     674:</span> <span class="f">#</span><span class="n">endif</span>
<a name="675" /><span class="False">     675:</span> 
<a name="676" /><span class="False">     676:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">pmd_mknonnuma</span>
<a name="677" /><span class="False">     677:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pmd_t</span> <span class="b">pmd_mknonnuma</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="678" /><span class="False">     678:</span> <span class="f">{</span>
<a name="679" /><span class="False">     679:</span>     <span class="b">pmd</span> <span class="f">=</span> <span class="b">pmd_clear_flags</span><span class="f">(</span><span class="b">pmd</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfTlVNQV8w"><span class="b">_PAGE_NUMA</span></a><span class="f">)</span><span class="f">;</span>
<a name="680" /><span class="False">     680:</span>     <span class="m">return</span> <span class="b">pmd_set_flags</span><span class="f">(</span><span class="b">pmd</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfUFJFU0VOVF8w"><span class="b">_PAGE_PRESENT</span></a><span class="f">|</span><a href="cpu.c_macros_ref.html#_X1BBR0VfQUNDRVNTRURfMA__"><span class="b">_PAGE_ACCESSED</span></a><span class="f">)</span><span class="f">;</span>
<a name="681" /><span class="False">     681:</span> <span class="f">}</span>
<a name="682" /><span class="False">     682:</span> <span class="f">#</span><span class="n">endif</span>
<a name="683" /><span class="False">     683:</span> 
<a name="684" /><span class="False">     684:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">pte_mknuma</span>
<a name="685" /><span class="False">     685:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">pte_mknuma</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="686" /><span class="False">     686:</span> <span class="f">{</span>
<a name="687" /><span class="False">     687:</span>     <span class="b">pte</span> <span class="f">=</span> <span class="b">pte_set_flags</span><span class="f">(</span><span class="b">pte</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfTlVNQV8w"><span class="b">_PAGE_NUMA</span></a><span class="f">)</span><span class="f">;</span>
<a name="688" /><span class="False">     688:</span>     <span class="m">return</span> <span class="b">pte_clear_flags</span><span class="f">(</span><span class="b">pte</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfUFJFU0VOVF8w"><span class="b">_PAGE_PRESENT</span></a><span class="f">)</span><span class="f">;</span>
<a name="689" /><span class="False">     689:</span> <span class="f">}</span>
<a name="690" /><span class="False">     690:</span> <span class="f">#</span><span class="n">endif</span>
<a name="691" /><span class="False">     691:</span> 
<a name="692" /><span class="False">     692:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">pmd_mknuma</span>
<a name="693" /><span class="False">     693:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pmd_t</span> <span class="b">pmd_mknuma</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="694" /><span class="False">     694:</span> <span class="f">{</span>
<a name="695" /><span class="False">     695:</span>     <span class="b">pmd</span> <span class="f">=</span> <span class="b">pmd_set_flags</span><span class="f">(</span><span class="b">pmd</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfTlVNQV8w"><span class="b">_PAGE_NUMA</span></a><span class="f">)</span><span class="f">;</span>
<a name="696" /><span class="False">     696:</span>     <span class="m">return</span> <span class="b">pmd_clear_flags</span><span class="f">(</span><span class="b">pmd</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfUFJFU0VOVF8w"><span class="b">_PAGE_PRESENT</span></a><span class="f">)</span><span class="f">;</span>
<a name="697" /><span class="False">     697:</span> <span class="f">}</span>
<a name="698" /><span class="False">     698:</span> <span class="f">#</span><span class="n">endif</span>
<a name="699" /><span class="False">     699:</span> <span class="f">#</span><span class="n">else</span>
<a name="700" /><span class="False">     700:</span> <span class="m">extern</span> <span class="m">int</span> <span class="b">pte_numa</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span><span class="f">;</span>
<a name="701" /><span class="False">     701:</span> <span class="m">extern</span> <span class="m">int</span> <span class="b">pmd_numa</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span><span class="f">;</span>
<a name="702" /><span class="False">     702:</span> <span class="m">extern</span> <span class="b">pte_t</span> <span class="b">pte_mknonnuma</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span><span class="f">;</span>
<a name="703" /><span class="False">     703:</span> <span class="m">extern</span> <span class="b">pmd_t</span> <span class="b">pmd_mknonnuma</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span><span class="f">;</span>
<a name="704" /><span class="False">     704:</span> <span class="m">extern</span> <span class="b">pte_t</span> <span class="b">pte_mknuma</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span><span class="f">;</span>
<a name="705" /><span class="False">     705:</span> <span class="m">extern</span> <span class="b">pmd_t</span> <span class="b">pmd_mknuma</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span><span class="f">;</span>
<a name="706" /><span class="False">     706:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_ARCH_USES_NUMA_PROT_NONE */</span>
<a name="707" /><span class="True">     707:</span> <span class="f">#</span><span class="n">else</span>
<a name="708" /><span class="True">     708:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pmd_numa</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="709" /><span class="True">     709:</span> <span class="f">{</span>
<a name="710" /><span class="True">     710:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="711" /><span class="True">     711:</span> <span class="f">}</span>
<a name="712" /><span class="True">     712:</span> 
<a name="713" /><span class="True">     713:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pte_numa</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="714" /><span class="True">     714:</span> <span class="f">{</span>
<a name="715" /><span class="True">     715:</span>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="716" /><span class="True">     716:</span> <span class="f">}</span>
<a name="717" /><span class="True">     717:</span> 
<a name="718" /><span class="True">     718:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">pte_mknonnuma</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="719" /><span class="True">     719:</span> <span class="f">{</span>
<a name="720" /><span class="True">     720:</span>     <span class="m">return</span> <span class="b">pte</span><span class="f">;</span>
<a name="721" /><span class="True">     721:</span> <span class="f">}</span>
<a name="722" /><span class="True">     722:</span> 
<a name="723" /><span class="True">     723:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pmd_t</span> <span class="b">pmd_mknonnuma</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="724" /><span class="True">     724:</span> <span class="f">{</span>
<a name="725" /><span class="True">     725:</span>     <span class="m">return</span> <span class="b">pmd</span><span class="f">;</span>
<a name="726" /><span class="True">     726:</span> <span class="f">}</span>
<a name="727" /><span class="True">     727:</span> 
<a name="728" /><span class="True">     728:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">pte_mknuma</span><span class="f">(</span><span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="729" /><span class="True">     729:</span> <span class="f">{</span>
<a name="730" /><span class="True">     730:</span>     <span class="m">return</span> <span class="b">pte</span><span class="f">;</span>
<a name="731" /><span class="True">     731:</span> <span class="f">}</span>
<a name="732" /><span class="True">     732:</span> 
<a name="733" /><span class="True">     733:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pmd_t</span> <span class="b">pmd_mknuma</span><span class="f">(</span><span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="734" /><span class="True">     734:</span> <span class="f">{</span>
<a name="735" /><span class="True">     735:</span>     <span class="m">return</span> <span class="b">pmd</span><span class="f">;</span>
<a name="736" /><span class="True">     736:</span> <span class="f">}</span>
<a name="737" /><span class="True">     737:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_NUMA_BALANCING */</span>
<a name="738" /><span class="True">     738:</span> 
<a name="739" /><span class="True">     739:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_MMU */</span>
<a name="740" /><span class="True">     740:</span> 
<a name="741" /><span class="True">     741:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* !__ASSEMBLY__ */</span>
<a name="742" /><span class="True">     742:</span> 
<a name="743" /><span class="True">     743:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_noref.html#_aW9fcmVtYXBfcGZuX3JhbmdlXzA_"><span class="b">io_remap_pfn_range</span></a>
<a name="744" /><span class="True">     744:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_aW9fcmVtYXBfcGZuX3JhbmdlXzA_"><span class="b">io_remap_pfn_range</span></a> <span class="b">remap_pfn_range</span>
<a name="745" /><span class="True">     745:</span> <span class="f">#</span><span class="n">endif</span>
<a name="746" /><span class="True">     746:</span> 
<a name="747" /><span class="True">     747:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* _ASM_GENERIC_PGTABLE_H */</span>
<a name="748" /><span class="True">     748:</span> </pre>
  </body>
</html>
